// import Vue from 'vue'
import { getRowValueByKey } from '/src/utils/index.js'
// import store from '/src/store'


// 这个是给菜单配置权限的，原来的代码是放在菜单配置中，比如permissions: ['crm', 'leads']
// export default {
//   inserted: function(el, binding) {
//     const show = getRowValueByKey(store.state.user, binding.value)
//     el.setAttribute('default-style', el.style.display)
//     if (!show) {
//       el.style.display = 'none'
//     }
//   },
//
//   update: function(el, binding) {
//     if (binding.value != binding.oldValue) {
//       const show = getRowValueByKey(store.state.user, binding.value)
//       el.style.display = show ? el.getAttribute('default-style') : 'none'
//     }
//   }
// }


export default (() => {
  function init (el, binding) {
    const value = binding.value;
    if (value === false) {
      el.style.display = "none"
    } else {
      el.style.display = ""
    }
  }
  return {
    mounted (el, binding) {
      init(el, binding)
    },
    updated (el, binding) {
      init(el, binding)
    }
  }
})()